<?php

function downloadFile($fileName=null){
    if($fileName==null){
        echo '文件不存在';
        exit;
    }
    if(is_file($fileName)){
        header("Content-Type: application/force-download");
        header("Content-Disposition: attachment; filename=".basename($fileName));
        
        readfile($fileName);
        exit;
    }else{
        echo "文件不存在";
        exit;
    }
}